Skip to content

fix(parser): set workspaceRootPath for Claude and OpenCode sessions - #86

Merged
Aymen (aymenfurter) merged 1 commit into
microsoft:mainfrom
JuliusGruber:fix/parser-workspace-root-path
May 30, 2026
Merged

Aymen (aymenfurter) merged 1 commit into
microsoft:mainfrom
JuliusGruber:fix/parser-workspace-root-path

Conversation

@JuliusGruber

Copy link
Copy Markdown
Contributor

Description

The Codex parser records the session cwd as workspaceRootPath, which lets config-health and Agentic SDLC workspace scans resolve the project root on disk (parser-harnesses.ts prefers session.workspaceRootPath when it exists on disk). The Claude and OpenCode parsers already capture the same information — cwd from the Claude JSONL user records and directory from the OpenCode session — but discard it, so their sessions have no resolvable root and those scans fall back to the harness data directory, returning empty for non-Codex harnesses.

This PR propagates the value the same way the Codex parser already does (value || undefined), so repo scans, dependency analysis, and other workspace-aware features work for Claude and OpenCode sessions too.

  • parser-claude.ts: set workspaceRootPath: cwd || undefined (cwd captured from the first user record).
  • parser-opencode.ts: set workspaceRootPath: rawSession.directory || undefined.
  • Adds a parser test per harness asserting the field is populated from the recorded cwd/directory.

No behavior change for sessions whose recorded path no longer exists on disk: the consumer's existing fs.existsSync guard still falls back to the prior root, identical to how the Codex parser already behaves.

Related Issues

N/A

Checklist

  • npm run check passes (typecheck + lint + spellcheck + knip + tests)
  • Changes are covered by tests (if applicable)
  • Documentation updated (if applicable)

🤖 Generated with Claude Code

The Codex parser records the session cwd as `workspaceRootPath`, which
lets config-health and Agentic SDLC workspace scans resolve the project
root on disk. The Claude and OpenCode parsers already capture the same
information — `cwd` from the Claude JSONL user records and `directory`
from the OpenCode session — but discard it, so their sessions have no
resolvable root and those scans return empty for non-Codex harnesses.

Propagate it the same way Codex does (`value || undefined`), so repo
scans, dependency analysis, and workspace-aware features work for Claude
and OpenCode sessions too. Adds a parser test per harness asserting the
field is populated from the recorded cwd/directory.
@JuliusGruber

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@aymenfurter Aymen (aymenfurter) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution Flusspferd (@JuliusGruber)! Clean fix — properly wires up workspaceRootPath for Claude and OpenCode sessions so downstream harness logic resolves paths against the correct workspace root. LGTM.

@aymenfurter
Aymen (aymenfurter) merged commit cb61436 into microsoft:main May 30, 2026
5 checks passed
Flusspferd (JuliusGruber) pushed a commit to JuliusGruber/AI-Engineering-Coach that referenced this pull request Jun 1, 2026
Resolved conflicts:
- src/core/metric-engine.ts: resolved toward upstream. Upstream microsoft#85
  (locale-independent serialization) converges with the fork's en-US pin
  (44e9532); dropped the fork's explanatory comment so the file is now
  byte-identical to upstream, retiring that fork drift.
- package.json: kept fork-additive engines.node>=20 and @types/ws 8.18.1;
  took upstream's vscode ^1.120.0, @types/vscode 1.120.0,
  @vitest/coverage-v8 4.1.7.
- package-lock.json: regenerated via npm install --package-lock-only.

Auto-merged cleanly: parser-claude{,.test}.ts, parser-opencode{,.test}.ts
(microsoft#86 workspaceRootPath), parser-codex.test.ts, panel-request-service.ts.

Build gate: npm run build:standalone OK.
Flusspferd (JuliusGruber) pushed a commit to JuliusGruber/AI-Engineering-Coach that referenced this pull request Jun 1, 2026
- Refresh AUTO sections: staleness banner (0 behind), counts block
  (52/12/1, gap 10, no DRIFT), gap-methods list (flags calibrateRule +
  runRuleTests as not-yet-bucketed TODOs), no new upstream RPC methods.
- Record the merge outcome: microsoft#53/microsoft#67/microsoft#85/microsoft#86 merged; metric-engine.ts drift
  retired (resolved toward upstream); fork-authored drift now 2 files
  (parser-codex.test.ts, panel-request-service.ts), both upstream-it.
- Preserved the human bucket A-E narrative.
Flusspferd (JuliusGruber) added a commit to JuliusGruber/AI-Engineering-Coach that referenced this pull request Jun 4, 2026
Synced to upstream 89c7688 (+19 commits). Refresh the [AUTO] banner/counts
(0 behind, gap 7, exposed 68; surface unchanged) and mark the bucket-E
per-harness Follow-up RESOLVED: upstream cb61436 (microsoft#86) sets workspaceRootPath
for the Claude and OpenCode parsers (parser-claude.ts:678, parser-opencode.ts:303)
-- exactly the upstream-it candidate the report flagged -- so SDLC repo-scan +
deps + Learning quiz personalization now resolve for all three harnesses.

Delta scanned per the append-only ledger rule: entirely bug fixes, webview/ReDoS
security hardening, dep bumps, docs, tests, and VS Code-only surfaces -- no new
feature bucket.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants